#include <iostream>

using namespace std;

const int N = 2e6 + 10;
int n, m;
int e[N]; 

int main()
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
	{
		cin >> e[i];
	}
	while(m--)
	{
		int x;
		cin >> x;
		cout << e[x] << endl; 
	}
	return 0;
}
